package com.ebuy.it.execludedemo.controller.jobhandler;


import com.ebuy.it.execludedemo.entity.Student;
import com.ebuy.it.execludedemo.service.IStudentService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import org.eclipse.jetty.http.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Gerante
 * @since 2019-04-04
 */
//@RestController
//@RequestMapping("/student")
@JobHandler(value="addStudentJobHandler")
@Component
public class StudentController extends IJobHandler {

    @Autowired
    private IStudentService studentService;
//    @PostMapping("/add")
    @Override
    public ReturnT execute(String param) {
        Student s = new Student();
        s.setSname("tom"+System.currentTimeMillis());
        s.setPassword("password"+System.currentTimeMillis());
        s.setPhone("1245724551152");
        Boolean a = studentService.insertStudentInfo(s);

        return new ReturnT(ReturnT.SUCCESS_CODE,"addStudentJobHandler执行成功！");
    }
}
